package com.cskaoyan.market.controller;

import com.cskaoyan.market.db.domain.MarketGoods;
import com.cskaoyan.market.service.GoodsService;
import com.cskaoyan.market.service.GoodsServiceImpl;
import com.cskaoyan.market.util.ProxyFactory;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/admin/goods/list")
public class GoodsController extends HttpServlet {
    GoodsService goodsService = (GoodsService) ProxyFactory.getProxyInstance(new GoodsServiceImpl());
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //展示出商品的列表信息
        List<MarketGoods> goodsList = goodsService.list();
        for (MarketGoods marketGoods : goodsList) {
            System.out.println(marketGoods);
        }
    }
}
